﻿<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<Sita.Entities.DeliveryNote>" %>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Remito</title>
    <link href="<%= Url.Content("~/Content/Styles/bootstrap.css") %>" rel="stylesheet"
        type="text/css" />
    <link href="<%= Url.Content("~/Content/Styles/bootstrap-theme.css") %>" rel="stylesheet"
        type="text/css" />
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-xs-5">
                <h1>
                    <img src="<%: Html.AuthenticateUrl("~/Content/Images/logo.png") %>">
                </h1>
            </div>
            <div class="col-xs-5 text-right">
                <h1>
                    Remito</h1>
                <h1>
                    <small>Nº
                        <%: Model.DeliveryNoteID %></small></h1>
                <h1>
                    <small>Fecha de emision:
                        <%: Model.CreationDate %></small></h1>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-6">
                <div class="panel panel-default">
                    <div class="panel-heading" style="background: white; padding: 0px;">
                        <h4>
                            De: <a href="#">Silgrada S.R.L.</a></h4>
                    </div>
                    <div class="panel-body" style="style="padding: 0px;">
                            <div style="width: 100%;">
                                Web:<%: Model.BusinessUnit.Web %><br />
                                Direccion:<%: Model.BusinessUnit.Address %><br />
                                Inicio de actividades:<%: Model.BusinessUnit.InitialDate %><br>
                                Email:<%: Model.BusinessUnit.Email %><br /><br />
                                <div style="width: 50%; float: left;">
                                    Codigo Postal:<%: Model.BusinessUnit.PostalCode %><br />
                                    Provincia:<%: Model.BusinessUnit.State %><br />
                                    Telefono:<%: Model.BusinessUnit.Phone %><br />
                                    Ing Brutos:<%: Model.BusinessUnit.Incomes %><br />
                                </div>
                                <div style="width: 50%; float: left;">
                                    IVA:<%: Model.BusinessUnit.IVAType %><br />
                                    Lugar de emision:<%: Model.BusinessUnit.Name %><br />
                                    CUIT:<%: Model.BusinessUnit.CUIT %><br />
                                </div>
                            </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-4 text-right">
                <div class="panel panel-default">
                    <div class="panel-heading" style="background: white; padding: 0px;">
                        <h4>
                            Para : <a href="#">
                                <%: Model.Customer.CompanyName %></a></h4>
                    </div>
                    <div class="panel-body" style="padding: 0px;">
                        <p>
                            Direccion:<%: Model.Customer.Address %><br />
                            Codigo Postal:<%: Model.Customer.PostalCode %><br />
                            IVA:<%: Model.Customer.IVAType %><br />
                            Nro:<%: Model.Customer.CustomerID %><br />
                            Provincia:<%: Model.Customer.State %><br />
                            CUIT:<%: Model.Customer.CUIT %><br />
                        </p>
                    </div>
                </div>
            </div>
        </div>
        <!-- / end client details section -->
        <div class="row text-right">
            <div class="col-xs-10">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td>
                                Codigo
                            </td>
                            <td>
                                Descripcion
                            </td>
                            <td>
                                Cantidad
                            </td>
                            <td>
                                Precio Unitario
                            </td>
                            <td>
                                Precio Total
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                        <% decimal totalPrice = 0;
                           decimal IVAPrice = 0;
                           decimal totalPriceWithIVA = 0;
                           foreach (Sita.Entities.DeliveryNoteReplacement item in Model.DeliveryNoteReplacements)
                           { %>
                        <tr>
                            <td>
                                <%: item.Replacement.Code %>
                            </td>
                            <td>
                                <%: item.Replacement.Name %>
                            </td>
                            <td>
                                <%: item.Quantity %>
                            </td>
                            <td>
                                <%: item.UnitPrice %>
                            </td>
                            <td>
                                <%: item.TotalPrice %>
                            </td>
                        </tr>
                        <%totalPrice += item.TotalPrice;
               }
               IVAPrice = totalPrice * 0.21M;
               totalPriceWithIVA = totalPrice + IVAPrice;
                        %>
                    </tbody>
                </table>
                        <div class="col-xs-2 col-xs-offset-6">
                <p>
                    <strong>Sub Total:<br>
                        IVA 21%:<br>
                        Total:<br>
                    </strong>
                </p>
            </div>
            <div class="col-xs-2">
                <strong>
                    <%: totalPrice %><br>
                    <%: IVAPrice %><br>
                    <%: totalPriceWithIVA %><br>
                </strong>
            </div>
            </div>
        </div>
    </div>
</body>
